home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / fileutil / fileutils-3.16.tar.gz / fileutils-3.16.tar / fileutils-3.16 / m4 / ccstdc.m4 next >
Text File  |  1996-12-20  |  2KB  |  62 lines

  1. ## ----------------------------------------- ##
  2. ## ANSIfy the C compiler whenever possible.  ##
  3. ## From Franc,ois Pinard                     ##
  4. ## ----------------------------------------- ##
  5.  
  6. # serial 1
  7.  
  8. # @defmac AC_PROG_CC_STDC
  9. # @maindex PROG_CC_STDC
  10. # @ovindex CC
  11. # If the C compiler in not in ANSI C mode by default, try to add an option
  12. # to output variable @code{CC} to make it so.  This macro tries various
  13. # options that select ANSI C on some system or another.  It considers the
  14. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  15. # handles function prototypes correctly.
  16. #
  17. # If you use this macro, you should check after calling it whether the C
  18. # compiler has been set to accept ANSI C; if not, the shell variable
  19. # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
  20. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  21. # program @code{ansi2knr}, which comes with Ghostscript.
  22. # @end defmac
  23.  
  24. AC_DEFUN(AM_PROG_CC_STDC,
  25. [AC_REQUIRE([AC_PROG_CC])
  26. AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  27. AC_CACHE_VAL(am_cv_prog_cc_stdc,
  28. [am_cv_prog_cc_stdc=no
  29. ac_save_CC="$CC"
  30. # Don't try gcc -ansi; that turns off useful extensions and
  31. # breaks some systems' header files.
  32. # AIX            -qlanglvl=ansi
  33. # Ultrix and OSF/1    -std1
  34. # HP-UX            -Aa -D_HPUX_SOURCE
  35. # SVR4            -Xc -D__EXTENSIONS__
  36. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
  37. do
  38.   CC="$ac_save_CC $ac_arg"
  39.   AC_TRY_COMPILE(
  40. [#if !defined(__STDC__) || __STDC__ != 1
  41. choke me
  42. #endif
  43. /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
  44. #ifdef _SEQUENT_
  45. # include <sys/types.h>
  46. # include <sys/stat.h>
  47. #endif
  48. ], [
  49. int test (int i, double x);
  50. struct s1 {int (*f) (int a);};
  51. struct s2 {int (*f) (double a);};],
  52. [am_cv_prog_cc_stdc="$ac_arg"; break])
  53. done
  54. CC="$ac_save_CC"
  55. ])
  56. AC_MSG_RESULT($am_cv_prog_cc_stdc)
  57. case "x$am_cv_prog_cc_stdc" in
  58.   x|xno) ;;
  59.   *) CC="$CC $am_cv_prog_cc_stdc" ;;
  60. esac
  61. ])
  62.